import type { Ref } from "vue";
import type { ChildData, IRangeObj } from "./pc-data";

export class ChildBusiness {

    private rangeObj: IRangeObj
    private rangeObj2: IRangeObj
    private data: ChildData;
    private data2: Ref<ChildData>


    constructor(rangeObj: IRangeObj, rangeObj2: IRangeObj, data: ChildData, data2: Ref<ChildData>) {
        this.rangeObj = rangeObj
        this.rangeObj2 = rangeObj2
        this.data = data
        this.data2 = data2
    }

    /**
     * changeRemark
     */
    public changeRemark(remark: string) {
        this.rangeObj.remark = remark
        this.rangeObj2.remark = remark
    }

    /**
   * changeRemark
   */
    public changeRemark2(remark: string) {
        if (this.data.rangeObj) {
            this.data.rangeObj.remark = remark
        }
        if (this.data2.value.rangeObj) {
            this.data2.value.rangeObj.remark = remark
        }
    }

    public print() {
        console.log(` 传入的reactive对象：${JSON.stringify(this.rangeObj)}`)
        console.log(` 传入的ref对象：${JSON.stringify(this.rangeObj2)}`)
        console.log(` 传入的this.data对象：`, this.data)
        console.log(` 传入的this.data2对象：`, this.data2.value)
    }

}